#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'tyh'
__mtime__ = '18-9-19'
# code is far away from bugs with the god animal protecting ~
"""
from flask import Blueprint, url_for, request, session, redirect

bp_admin = Blueprint("bp_admin", __name__)

@bp_admin.before_request
def admin_before_request():

	if not request.url.endswith(url_for("bp_admin.admin_login")):
		is_admin = session.get("is_admin", None)
		user_id = session.get("user_id", None)

		if (not user_id) or (not is_admin):
			return redirect("/admin")


from . import views

if __name__ == '__main__':
	pass